<%@ page language="java" import="java.util.*,com.king.cms.common.PowerParameter" pageEncoding="utf-8"%>
<%@ page contentType="text/html;charset=gb2312" %>
<%@ include file="/hotel/include/css.jsp"%>
<%-- /*包含css样式表*/ --%>
<%  
	String pageFunc = "菜肴维护";		//功能描述
%>
<% 
	int pow=(PowerParameter.save | PowerParameter.cls | PowerParameter.list);
	String group = (String)request.getAttribute("group");
	Map m = (Map)request.getAttribute("data");
	if(null == m)
	  m = new HashMap();
%>


<html>
	<head>
		<title><%=pageFunc%>
		</title>
		<meta  http-equiv="Expires"     CONTENT="0">           
<meta  http-equiv="Cache-Control"     CONTENT="no-cache">           
<meta  http-equiv="Pragma"     CONTENT="no-cache">
<meta content="text/html; charset=gb2312" http-equiv=Content-Type>

		<script language="javascript">
	function doEnable()
	{
		form1.bmMc.disabled=false;
		form1.bmBzrs.disabled=false;
	} 
	function ki_save(){
      var flag = true;
      var size = document.all.musicName.length;
      if(size<1){
           size = 1;
      }
      for(var i =0;i<size;i++){
         if(clskg(document.all.musicName[i].value) == '') {
	 	   alert('音乐名称不能为空');
	 	   flag = false;
	 	   return;
	     }
	     if(clskg(document.all.musicNum[i].value) == '') {
	 	   alert('音乐排序号不能为空');
	 	   flag = false;
	 	   return;
	     }
	  if(document.all.fileupload[i].value == "") {
	 	   alert('请选择上传的音乐');
	 	   flag = false;
	 	   return;
	  }
	
      }
	  
	 if(flag)
	    form1.submit();
	}
	function ki_cls(){
	    var file = document.getElementById("fileupload");
		document.getElementById("musicName").value='';
		document.getElementById("musicDesc").value='';
		document.getElementById("musicNum").selectedIndex=0;
		file.outerHTML=file.outerHTML;
	}
	function ki_list(){
		window.open('<%=basePath%>mult/musicAction.do?action=list','_self');
	}
	////////除去空格/////////
	function clskg(va){
	  var th=/\s/g;
	 va=va.replace(th,'');
	 return va;
	}
	
	function add(){
	var line=event.srcElement.parentElement.rowIndex;
	var num=document.all.table.rows[line];
	var totalline=document.all.table.rows.length;
	if(totalline>7){
	    alert("一次最多只能上传5个");
	    return;
	}
	hao=num.cells[0].innerText;
	var xuhao=parseFloat(hao);
	var newTR = num.cloneNode(true);
	newTR.id="tr";
	num.insertAdjacentElement("afterEnd",newTR);
	
	var kkk=1;
	for(var ii=0;ii<totalline;ii++){//从第一行开始循环到最后一行
	   var ddd=document.all.table.rows[ii].id;//取得每一行TR的id值
	   if(ddd=="tr"){//如果id值为"tr"，则可判断该行有文本框
	   document.all.table.rows[ii].cells[0].innerText=kkk;//把该行第一个单元格中显示的内容设置为kkk
	   kkk=kkk+1;//kkk+1
	   }
	}
	document.all.musicName[xuhao].value="";
    document.all.musicDesc[xuhao].value="";
    document.all.musicNum[xuhao].value="";
   }
</script>
	</head>
	<body background="<%=imgpath%>top3.gif" leftmargin="0" topmargin="0">
		 <br> 
		 <center>
		<form name="form1" method="post" enctype="multipart/form-data"  action="<%=basePath%>mult/musicAction.do?action=update">
			<table border="0" cellpadding="0" cellspacing="0" align="center" width="98%"
				height="2">
				<tr>
					<td width="9" height="1"></td>
					<td height="1" background="<%=path%>/img/images_06.gif">
						<p align="center">
							<b><%=pageFunc%></b>
					</td>
					<td width="9" height="1"></td>
				</tr>
			</table>
			<table id="table" height="48" border="0" cellpadding="2" cellspacing="1"
				class="bg_table" style="width:90%" bordercolor="#111111">
				<tr class="top_td">
					<td colspan="5"  >
						 <%if(null != m.get("ID")){ %>修改音乐<%}else{ %>添加音乐<%} %>
					</td>
				</tr>
				<tr class="td1">
					<td>序号</td><td>音乐名称</td><td>音乐描述</td><td>排序号</td><td>上传音乐</td>
				</tr>
				<tr id="tr" onDblClick="" class="td2" >
					<td width="4%">
						1
					</td>
					<td width="14%"   >
					    <input type="hidden" value="<%=m.get("ID")==null?"":m.get("ID") %>" name="musicId">
					    <input type="hidden" value="<%=m.get("MUSIC_FILE_PATH")==null?"":m.get("MUSIC_FILE_PATH") %>" name="musicPath">
					    <input type="hidden" value="<%=m.get("MUSIC_FORMAT")==null?"":m.get("MUSIC_FORMAT") %>" name="musicType">
						<input type="text" name="musicName" id="musicName" style="width:95%" value="<%=m.get("MUSIC_NAME")==null?"":m.get("MUSIC_NAME") %>" class="area100"  check="c_n_50">
					</td>
					<td width="45%">
						<input type="text" name="musicDesc" id ="musicDesc" style="width:95%" value="<%=m.get("MUSIC_DESC")==null?"":m.get("MUSIC_DESC") %>" class="area100"  check="c_n_50">
					</td>
					<td width="7%" >
					   <input type="text" name="musicNum" id ="musicNum" style="width:95%" value="<%=m.get("OREDER_NUM")==null?"":m.get("OREDER_NUM") %>" class="area100"  check="c_n_50">
					</td>
					<td width="30%">
						<input type="file" name="fileupload" id="fileupload" size="70"  style="width:95%"  class="area100" ContentEditable="false" >
					</td>	
				</tr>
				
				<tr class="top_td">
					<td colspan="5"> 
					</td>
				</tr>
			</table>
</form>
</center>
		</body>
</html>
<%@ include file="/hotel/pow.jsp"%>
